package day_06;

import java.util.Scanner;

/**
 * @ClassName day06_morning
 * @Description TODO
 * @Author hp
 * @Date 2021/6/8 8:27
 * @Version 1.0
 **/
public class day06_morning_1 {
    public static void main(String[] args) {
        int[] months = new int[]{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        Scanner scanner = new Scanner(System.in);
        int year, month;

        do {
            System.out.println("请输入年份:");
            year = scanner.nextInt();
            System.out.println("请输入月份:");
            month = scanner.nextInt();
            if (year<=0||month<=0||month>12){
                System.out.println("输入有误请重新输入:");
            }
        } while (year <= 0||month<=0||month>12);
        if (year%4==0&&year%100!=0||year%400==0){
            months[1]++;
        }
        System.out.println(year+"年"+month+"月份有"+months[month-1]+"天");

    }
}
